package com.tom.common.utils;


import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;
import org.springframework.stereotype.Component;

/**
 * @author longjiang
 * @date 2020-01-17 3:33 下午
 * @description 密码加密
 **/
@Component
public class PasswordEncrypterUtil {

    /**
     * 密码加密
     * @param password
     * @return
     */
    public String  encryptPassword(String salt,String password) {

        /**
         * 散列算法
         */
        String algorithmName = "md5";
        /**
         * 散列次数
                */
        int hashIterations = 2;


        return new SimpleHash(algorithmName, password,ByteSource.Util.bytes(salt), hashIterations).toHex();

    }



}
